<div id="Substitution-modes"></div>
<div class="header">
<p>
Next: [[cvs: Configuring Keyord Expansion#Configuring Keyord Expansion|Configuring keyword expansion]], Previous: [[cvs: Avoiding substitution#Avoiding substitution|Avoiding substitution]], Up: [[cvs: Keyword substitution#Keyword substitution|Keyword substitution]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Substitution-modes-1"></div>
=== Substitution modes ===
<div id="index-Keyword-substitution_002c-changing-modes"></div>
<div id="index-_002dk-_0028keyword-substitution_0029"></div>
<div id="index-Kflag"></div>

Each file has a stored default substitution mode, and
each working directory copy of a file also has a
substitution mode.  The former is set by the &lsquo;<code>-k</code>&rsquo;
option to <code>cvs add</code> and <code>cvs admin</code>; the
latter is set by the &lsquo;<code>-k</code>&rsquo; or &lsquo;<code>-A</code>&rsquo; options to <code>cvs
checkout</code> or <code>cvs update</code>.  <code>cvs diff</code> also
has a &lsquo;<code>-k</code>&rsquo; option.  For some examples,
see [[cvs: Handling binary files#Handling binary files|Binary files]], and [[cvs: Merging and keywords#Merging and keywords|Merging and keywords]].

The modes available are:

;&lsquo;<code>-kkv</code>&rsquo;
: Generate keyword strings using the default form, e.g. <code>$<i></i>Revision: 5.7 $</code> for the <code>Revision</code> keyword.

;&lsquo;<code>-kkvl</code>&rsquo;
: Like &lsquo;<code>-kkv</code>&rsquo;, except that a locker&rsquo;s name is always inserted if the given revision is currently locked. The locker&rsquo;s name is only relevant if <code>cvs admin -l</code> is in use.

;&lsquo;<code>-kk</code>&rsquo;
: Generate only keyword names in keyword strings; omit their values.  For example, for the <code>Revision</code> keyword, generate the string <code>$<i></i>Revision$</code> instead of <code>$<i></i>Revision: 5.7 $</code>.  This option is useful to ignore differences due to keyword substitution when comparing different revisions of a file (see [[cvs: Merging and keywords#Merging and keywords|Merging and keywords]]).

;&lsquo;<code>-ko</code>&rsquo;
: Generate the old keyword string, present in the working file just before it was checked in.  For example, for the <code>Revision</code> keyword, generate the string <code>$<i></i>Revision: 1.1 $</code> instead of <code>$<i></i>Revision: 5.7 $</code> if that is how the string appeared when the file was checked in.

;&lsquo;<code>-kb</code>&rsquo;
: Like &lsquo;<code>-ko</code>&rsquo;, but also inhibit conversion of line endings between the canonical form in which they are stored in the repository (linefeed only), and the form appropriate to the operating system in use on the client.  For systems, like unix, which use linefeed only to terminate lines, this is very similar to &lsquo;<code>-ko</code>&rsquo;.  For more information on binary files, see [[cvs: Handling binary files#Handling binary files|Binary files]].  In <small>CVS</small> version 1.12.2 and later &lsquo;<code>-kb</code>&rsquo;, as set by <code>cvs add</code>, <code>cvs admin</code>, or <code>cvs import</code> may not be overridden by a &lsquo;<code>-k</code>&rsquo; option specified on the command line.

;&lsquo;<code>-kv</code>&rsquo;
: Generate only keyword values for keyword strings.  For example, for the <code>Revision</code> keyword, generate the string <code>5.7</code> instead of <code>$<i></i>Revision: 5.7 $</code>. This can help generate files in programming languages where it is hard to strip keyword delimiters like <code>$<i></i>Revision: $</code> from a string.  However, further keyword substitution cannot be performed once the keyword names are removed, so this option should be used with care.

: One often would like to use &lsquo;<code>-kv</code>&rsquo; with <code>cvs export</code>&mdash;see [[cvs: export--Export sources from CVS, similar to checkout#export&mdash;Export sources from CVS, similar to checkout|export]].  But be aware that doesn&rsquo;t handle an export containing binary files correctly.



----

<div class="header">
<p>
Next: [[cvs: Configuring Keyord Expansion#Configuring Keyord Expansion|Configuring keyword expansion]], Previous: [[cvs: Avoiding substitution#Avoiding substitution|Avoiding substitution]], Up: [[cvs: Keyword substitution#Keyword substitution|Keyword substitution]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
